package com.cloud.pole.shop.biz.goods;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ace.cache.annotation.Cache;
import com.ace.cache.annotation.CacheClear;
import com.cloud.pole.common.biz.BaseBiz;
import com.cloud.pole.mapper.goods.ShopGoodsMapper;
import com.cloud.pole.shop.model.entity.goods.ShopGoods;
import com.cloud.pole.shop.model.entity.goods.ShopGoodsAdmin;
import com.cloud.pole.shop.model.vo.goods.ShopGoodsVo;

/**
 * ${DESCRIPTION}
 *
 * @author wanghaobin
 * @create 2017-06-08 16:23
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class ShopGoodsBiz extends BaseBiz<ShopGoodsMapper, ShopGoods> {
	
	@Cache(key="shopGoods{1}")
    public ShopGoods selectByPrimaryKey(Integer id) {
		 return mapper.selectByPrimaryKey(id);
    }
	
	public List<ShopGoodsAdmin> selectPageShopGoodsAdminList(Map<String, Object> map) {
		return mapper.selectPageShopGoodsAdminList(map);
	}
	
	@Override
	@CacheClear(key= "shopGoods{1.goodsId}")
	public void updateSelectiveById(ShopGoods shopGoods) {
		super.updateSelectiveById(shopGoods);
	}
	
	public List<ShopGoods> selectPageShopGoodsListByMap(Map<String, Object> map) {
		return mapper.selectPageShopGoodsListByMap(map);
	}

	public List<ShopGoods> selectPageShopGoodsListByGroupId(Map<String, Object> map) {
		return mapper.selectPageShopGoodsListByGroupId(map);
	}
	
	public List<ShopGoods> selectByShopId(Integer shopId) {
		return mapper.selectByShopsId(shopId);
	}

	public ShopGoods selectRechargeGoods(String shopId) {
		return mapper.selectRechargeGoods(shopId);
	}
}
